package com.example.demo.config;

import com.example.demo.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//user 没登录不可操作必须登录 的 拦截器，这个拦截器 的激活代码
@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer{
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String [] addPathPatterns={
            "/cart/*",
        };
        String [] excludePathPatterns={

        };
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns(addPathPatterns).excludePathPatterns(excludePathPatterns);
    }


}
